package com.lcb123.user;

import com.lcb123.framework.domain.User;
import com.lcb123.framework.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.logging.Logger;

/**
 * Created by yiban on 2017/4/6.
 */

@RestController
public class UserController {

    private final Logger logger = Logger.getLogger("UserController.class");
    @Resource
    private UserService userService;

    @RequestMapping(value = "/" ,method = RequestMethod.GET)
    public String add(@RequestParam String nick) {

        logger.info("/nick" + nick );
        User user = userService.getUserByUsername(nick);
        return "From Service-A, Result is "+user.toString() ;
    }

}